const webpack = require('webpack')
const merge = require('webpack-merge')
const base = require('./base')
const uglufy = require('uglifyjs-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const rootPath = process.cwd()
module.exports = merge(base, {
  entry: rootPath + "/src/main.js",
  output: {
    path: rootPath + '/build/',
    filename: "static/front/js/bundle.js",
    publicPath: '/'
  },
  plugins: [
    new uglufy(),
    new webpack.DefinePlugin({
      "process.env": {
        NODE_ENV: JSON.stringify('production')
      }
    }),
    new CleanWebpackPlugin(
      ['build/static/js/*', 'build/static/css/app.css', 'build/static/images/*'],
      {
          root: rootPath
      }
    )
  ]
})
